//
//  RateListCell.m
//  ImGuider
//
//  Created by 李陆涛 on 2018/2/28.
//  Copyright © 2018年 imguider. All rights reserved.
//

#import "RateListCell.h"

@interface RateListCell ()

@property (weak, nonatomic) IBOutlet UIImageView *flagImageView;
@property (weak, nonatomic) IBOutlet UILabel *currencyNameLabel;

@property (weak, nonatomic) IBOutlet UIButton *chooseBtn;

@end

@implementation RateListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    [self.chooseBtn setTitle:[NSString stringWithFormat:@"%@ ✓",MYLocalizedString(@"EXCHANGE_RATE_SELECTED", nil)] forState:UIControlStateNormal];
    
    self.flagImageView.layer.cornerRadius = 15.0f;
    self.flagImageView.layer.borderWidth = 1.0f;
    self.flagImageView.layer.borderColor = kBGColor.CGColor;
}

- (void)setMode:(RateMode *)mode {
    
    _mode = mode;
    
    [self.flagImageView setImageURL:[NSURL URLWithString:mode.pictures] placeholderImage:kPlaceholderSqu];
    
    self.currencyNameLabel.text = [NSString stringWithFormat:@"%@-%@",mode.smartName,mode.code];
    
    if ([[CountryManager sharedManager].saveRateArray containsObject:mode.code]) {
        
        self.chooseBtn.hidden = NO;
    } else {
        
        self.chooseBtn.hidden = YES;
    }
}

@end
